package com.cn.kabalifeuser.ui.service.adapter;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.cn.kabalifeuser.R;
import com.cn.kabalifeuser.ui.service.bean.RecruitListBean;

import java.util.List;

/**
 * Created by 晓林 on 2020/9/11.
 * function:
 */
public class RecruitListAdapter extends BaseQuickAdapter<RecruitListBean.ResultBean.DataBean, BaseViewHolder> {

    public RecruitListAdapter(int layoutResId, @Nullable List<RecruitListBean.ResultBean.DataBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, final RecruitListBean.ResultBean.DataBean item) {
        helper.setText(R.id.tv_time, item.getCreated_at())
                .setText(R.id.tv_content, item.getBrief())
                .setText(R.id.tv_comment, String.valueOf(item.getComment()));
        ImageView imageView = helper.getView(R.id.img_top);
        TextView tvName = helper.getView(R.id.tv_name);
        TextView tvNum = helper.getView(R.id.tv_num);
        tvName.setText(item.getTitle());
        tvNum.setText(String.valueOf(item.getNum()));
        if (helper.getPosition() == 0) {
            imageView.setVisibility(View.VISIBLE);
            tvName.setTextColor(this.mContext.getResources().getColor(R.color.main_white));
            tvNum.setTextColor(this.mContext.getResources().getColor(R.color.main_white));
        } else {
            imageView.setVisibility(View.GONE);
            tvName.setTextColor(this.mContext.getResources().getColor(R.color.font_000));
            tvNum.setTextColor(this.mContext.getResources().getColor(R.color.main_color));
        }
    }
}
